package com.llkj.qingnianguoxue.adapter;

import android.widget.FrameLayout;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.llkj.qingnianguoxue.R;
import com.llkj.qingnianguoxue.bean.HotRankingBean;
import com.llkj.qingnianguoxue.util.DisplayUtil;
import com.llkj.qingnianguoxue.util.ImageLoadingUtil;

import java.util.List;

/**
 * 我点赞过的视频
 */
public class MyPraisesAdapter extends BaseQuickAdapter<HotRankingBean.RankingBean, BaseViewHolder> {

    public MyPraisesAdapter(int layoutResId, List<HotRankingBean.RankingBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, HotRankingBean.RankingBean item) {
        ImageView ivPic = baseViewHolder.getView(R.id.pic);
        ImageLoadingUtil.loadImgGlideRound(ivPic, item.getImg());
        baseViewHolder.setText(R.id.tv_title, item.getTitle());//
        baseViewHolder.setText(R.id.tv_introduction, item.getAbstractX());
        baseViewHolder.setText(R.id.tv_video_time, item.getDuration());

        FrameLayout.LayoutParams picParam = (FrameLayout.LayoutParams) ivPic.getLayoutParams();
        picParam.width = DisplayUtil.getDensityWdith(mContext)*180/750;
        picParam.height = picParam.width*9/16;
    }
}
